<template>
  <div class="body">
    <div>{{item}}</div>
    <router-link to="/two">跳转12</router-link>
  </div>
</template>

<script>
import axios from "axios";
export default {
  asyncData({ store, route }) {
    axios.get("/api/1").then(res => {
      console.log(res);
    });
    // 触发 action 后，会返回 Promise
    return store.dispatch("fetchItem", 2);
  },
  computed: {
    // 从 store 的 state 对象中的获取 item。
    item() {
      return this.$store.state.count;
    }
  }
};
</script>

<style scoped>
</style>